home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Data 2002 May / CD Rom Data Mayıs 2002.iso / Freeware / Blitz Basic / data1.cab / Support / help / commands / 2d_examples / echoserver.bb < prev   
Encoding:
Text File  |  2002-04-10  |  496 b   |  21 lines

  1.  
  2. AppTitle "Blitz UDP Echo Server"
  3.  
  4. UDPTimeouts 1000
  5.  
  6. udp=CreateUDPStream( 7 )
  7. If Not udp RuntimeError "CreateUDPStream failed"
  8.  
  9. Print "Echo Server - "+DottedIP$( UDPStreamIP( udp ) )+":"+UDPStreamPort( udp )
  10.  
  11. Repeat
  12.     ip=RecvUDPMsg( udp )
  13.     If Eof( udp )<0 RuntimeError "RecvUDPMsg failed"
  14.     If ip
  15.         CopyStream udp,udp    ;The Echo bit - COOL!
  16.         SendUDPMsg udp,ip,UDPMsgPort(udp)
  17.         cnt=cnt+1
  18.         Print cnt+")"+DottedIP$( UDPMsgIP( udp ) )+":"+UDPMsgPort( udp )
  19.     EndIf
  20.     Delay 0
  21. Forever